package gx.service;

import java.util.Date;

import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import gx.dao.PurchaseDao;
import gx.entity.Purchase;
import gx.entity.common.Page;
import gx.service.common.BaseService;



@Service
public class PurchaseService extends BaseService<Purchase> {
	private PurchaseDao purchaseDao;

	public PurchaseDao getPurchaseDao() {
		return purchaseDao;
	}

	@Autowired
	public void setPurchaseDao(PurchaseDao purchaseDao) {
		this.purchaseDao = purchaseDao;
		super.setDao(this.purchaseDao);
	}

	public Page<Purchase> findByStatus(int size, int number,Integer...status ) {//Inreger...status 可变参数
		
		return purchaseDao.findByStatus(size,number,status);
	}

	public Page<Purchase> findByCriteria(int size, int number, DetachedCriteria dc, DetachedCriteria dc2, DetachedCriteria dc3) {
		return purchaseDao.findByCriteria(size, number, dc, dc2,dc3);
	}
	
	public static Date getAfterDate(Date date,int count){
		Date d=null;
		d=new Date(date.getTime()+count*24*60*60*1000L);
		return d;
		
	}
	

}
